package main

import (
	"fmt"
	"time"
)

func dotask(c chan func())  {
	time.Sleep(1)
	t := <- c
	t()
}

func main() {
	var a int = 5
	t := func (){
		fmt.Println("test:",a)
	}


	c := make(chan func())
	go dotask(c)

	c <- t
	a = 6

	time.Sleep(2)
}